﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PerfilEmpreendedor.FrontEnd.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="UserControls/Jogador.ascx" TagName="JogadorControl" TagPrefix="uc" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
      <link href="Css/Estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <ext:Viewport ID="Viewport1" runat="server">
        <Items>
            <ext:ColumnLayout ID="ColumnLayout1" runat="server" Split="false" FitHeight="true">
                <Columns>
                    <ext:LayoutColumn ColumnWidth="0.2">
                        <ext:Panel ID="Panel1" runat="server" Title="Perfil Empreendedor" Border=false>
                        <Content>
                        
                         <uc:JogadorControl ID="ucJogador" runat=server></uc:JogadorControl>
                        </Content>
                        </ext:Panel>
                    </ext:LayoutColumn>
                    <ext:LayoutColumn ColumnWidth="0.60">
                        <ext:Panel ID="Panel2" runat="server" Title="Partidas Abertas">
                            <Items>
                                <ext:GridPanel ID="gridDados" runat="server" Height="350">
                                    <Store>
                                        <ext:Store ID="storeDados">
                                            <Reader>
                                                <ext:ArrayReader IDProperty="Id">
                                                    <Fields>
                                                        <ext:RecordField Name="Id" />
                                                        <ext:RecordField Name="Descricao" />
                                                        <ext:RecordField Name="Nivel" />
                                                        <ext:RecordField Name="JogadoresInscritos" />
                                                    </Fields>
                                                </ext:ArrayReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                            <ext:CommandColumn Width="50" ButtonAlign="Center">
                                                <Commands>
                                                    <ext:GridCommand Icon=DatabaseEdit  CommandName="Detalhar">
                                                        <ToolTip Text="Clique para detalhar" />
                                                    </ext:GridCommand>
                                                </Commands>
                                            </ext:CommandColumn>
                                            <ext:Column Header="Descrição" Width="300" DataIndex="Descricao" />
                                            <ext:Column Header="Nível" Width="100" DataIndex="Nivel" />
                                            <ext:Column Header="Inscritos" Width="100" DataIndex="JogadoresInscritos" />
                                        </Columns>
                                    </ColumnModel>
                                    <DirectEvents>
                                        <Command OnEvent="Detalhar">
                                            <EventMask Msg="Aguarde..." ShowMask="true" />
                                            <ExtraParams>
                                                <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                                <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                            </ExtraParams>
                                        </Command>
                                    </DirectEvents>
                                    <BottomBar>
                                        <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" DisplayInfo="true"
                                            DisplayMsg="Exibindo registros {0} - {1} of {2}" EmptyMsg="Nenhum registro localizado" />
                                    </BottomBar>
                                </ext:GridPanel>
                                <ext:GridPanel ID="gridPartidasIniciadas" runat="server" Height="300" Title="Partidas que você está jogando no momento">
                                    <Store>
                                        <ext:Store ID="storePartidasIniciadas">
                                            <Reader>
                                                <ext:ArrayReader IDProperty="Id">
                                                    <Fields>
                                                        <ext:RecordField Name="Id" />
                                                        <ext:RecordField Name="Descricao" />
                                                        <ext:RecordField Name="Posicao" />
                                                    </Fields>
                                                </ext:ArrayReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                            <ext:CommandColumn Width="100" ButtonAlign="Center">
                                                <Commands>
                                                    <ext:GridCommand Icon=ArrowRight Text="Jogar agora" CommandName="JogarAgora">
                                                        <ToolTip Text="Clique para ir para esta partida" />
                                                    </ext:GridCommand>
                                                </Commands>
                                            </ext:CommandColumn>
                                            <ext:Column Header="Descrição" Width="300" DataIndex="Descricao" />
                                            <ext:Column Header="Posição" Width="100" DataIndex="Posicao" />
                                        </Columns>
                                    </ColumnModel>
                                    <DirectEvents>
                                        <Command OnEvent="IrParaPartida">
                                            <EventMask Msg="Aguarde..." ShowMask="true" />
                                            <ExtraParams>
                                                <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                                <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                            </ExtraParams>
                                        </Command>
                                    </DirectEvents>
                                </ext:GridPanel>
                            </Items>
                        </ext:Panel>
                    </ext:LayoutColumn>
                   <ext:LayoutColumn ColumnWidth="0.2">
                    <ext:Panel ID="Panel3" runat="server" Title="Ranking Top 20" Border=false>
                      <Items>
                       <ext:GridPanel ID="gridRanking" runat="server" Height="800">
                                    <Store>
                                        <ext:Store ID="storeRanking">
                                            <Reader>
                                                <ext:JsonReader IDProperty="Id">
                                                    <Fields>
                                                        <ext:RecordField Name="Jogador" />
                                                        <ext:RecordField Name="Pontuacao" />
                                                    </Fields>
                                                </ext:JsonReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                            <ext:Column Header="Jogador" Width="140" DataIndex="Jogador" />
                                            <ext:Column Header="Pontuacão" Width="100" DataIndex="Pontuacao" />
                                        </Columns>
                                    </ColumnModel>
                                </ext:GridPanel>
                      
                      </Items>
                        </ext:Panel>
                   </ext:LayoutColumn>
                </Columns>
            </ext:ColumnLayout>
        </Items>
    </ext:Viewport>
   <ext:Window ID="windowDetalhe" runat="server" Collapsible="false" Height="410" Icon="UserTick"
    Title="Detalhes da Partida" Width="600" Hidden="true" InitCenter="true" Resizable="false"
    Modal="true">
        <Items>
            <ext:FormPanel ID="formCadastro" runat="server"  Padding="5"
                Height="380" ButtonAlign="Right">
                <Items>
                    <ext:Hidden ID="hiddenId" runat="server">
                    </ext:Hidden>
                    <ext:Label ID="lblDescricao" LabelWidth="300" AnchorHorizontal="100%" runat="server"
                        FieldLabel="Descrição da partida" />
                    <ext:Label ID="lblNivel" runat="server" AnchorHorizontal="100%" FieldLabel="Nível" />
                    <ext:Label ID="lblTempo" runat="server" AnchorHorizontal="100%" FieldLabel="Tempo de Resposta" />
                    <ext:Label ID="lblIniciada" runat="server" AnchorHorizontal="100%" FieldLabel="Iniciada" />
                    <ext:GridPanel ID="gridJogadores" runat="server" AnchorHorizontal="95%" Height="140"
                        Title="Participantes">
                        <Store>
                            <ext:Store ID="storeJogadores">
                                <Reader>
                                    <ext:ArrayReader IDProperty="Id">
                                        <Fields>
                                            <ext:RecordField Name="Id" />
                                            <ext:RecordField Name="Login" />
                                            <ext:RecordField Name="Posicao" />
                                        </Fields>
                                    </ext:ArrayReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel>
                            <Columns>
                                <ext:Column Width="400" DataIndex="Login" Header="Login" />
                                <ext:Column Width="100" DataIndex="Posicao" Header="Posição" />
                            </Columns>
                        </ColumnModel>
                    </ext:GridPanel>
                </Items>
                <Buttons>
                    <ext:Button ID="btnIngressar" runat="server" Text="Participar" Icon="UserGo">
                        <DirectEvents>
                            <Click OnEvent="Participar">
                                <EventMask ShowMask="true" Msg="Aguarde, ingressando na partida..." MinDelay="2" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                     <ext:Button ID="btnCancelarParticipacao" runat="server" Text="Cancelar Participação" Icon=Delete>
                      <DirectEvents>
                            <Click OnEvent="CancelarParticipacao">
                                <EventMask ShowMask="true" Msg="Aguarde, ingressando na partida..." MinDelay="2" />
                            </Click>
                        </DirectEvents>
                     </ext:Button>
                    <ext:Button ID="btnCancelar" runat="server" Text="Fechar" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{windowDetalhe}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
    </ext:Window>
    </form>
</body>
</html>
